﻿using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using System.Text;
using Maticsoft.Common;
 
namespace StuEdu.Web.StuAction
{
    public partial class Modify : Page
    {       

        		protected void Page_Load(object sender, EventArgs e)
		{
			if (!Page.IsPostBack)
			{
				if (Request.Params["id"] != null && Request.Params["id"].Trim() != "")
				{
					int stuActionId=(Convert.ToInt32(Request.Params["id"]));
					ShowInfo(stuActionId);
				}
			}
		}
			
	private void ShowInfo(int stuActionId)
	{
		StuEdu.BLL.StuAction bll=new StuEdu.BLL.StuAction();
		StuEdu.Model.StuAction model=bll.GetModel(stuActionId);
		this.lblstuActionId.Text=model.stuActionId.ToString();
		this.txtstuActionName.Text=model.stuActionName;
		this.txtstuActionDes.Text=model.stuActionDes;

	}

		public void btnSave_Click(object sender, EventArgs e)
		{
			
			string strErr="";
			if(this.txtstuActionName.Text.Trim().Length==0)
			{
				strErr+="stuActionName不能为空！\\n";	
			}
			if(this.txtstuActionDes.Text.Trim().Length==0)
			{
				strErr+="stuActionDes不能为空！\\n";	
			}

			if(strErr!="")
			{
				MessageBox.Show(this,strErr);
				return;
			}
			int stuActionId=int.Parse(this.lblstuActionId.Text);
			string stuActionName=this.txtstuActionName.Text;
			string stuActionDes=this.txtstuActionDes.Text;


			StuEdu.Model.StuAction model=new StuEdu.Model.StuAction();
			model.stuActionId=stuActionId;
			model.stuActionName=stuActionName;
			model.stuActionDes=stuActionDes;

			StuEdu.BLL.StuAction bll=new StuEdu.BLL.StuAction();
			bll.Update(model);
			Maticsoft.Common.MessageBox.ShowAndRedirect(this,"保存成功！","list.aspx");

		}


        public void btnCancle_Click(object sender, EventArgs e)
        {
            Response.Redirect("list.aspx");
        }
    }
}
